package com.youdianda.mapper;

import com.youdianda.entity.SysRoleMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author xliu
* @description 针对表【sys_role_menu(角色-菜单)】的数据库操作Mapper
* @createDate 2023-05-14 16:01:07
* @Entity com.youdianda.entity.SysRoleMenu
*/
@Mapper
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {

    /**
     * 根据角色id查询对应的菜单id列表
     * @param role_id
     * @return
     */
    @Select("select menu_id from sys_role_menu where role_id = #{role_id};")
    List<String> listMenuIdByRoleId(String role_id);

    /**
     * 根据roleId删除角色菜单数据
     * @param roleId
     */
    @Delete("delete from sys_role_menu where role_id = #{roleId};")
    void deleteByRoleId(String roleId);
}




